﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace ProjectRoughWork
{
    class Node
    {
        /// <summary>
        /// Default constructor 
        /// </summary>
        /// <param name="initPos">The initial position of the node</param>

        public Node(Vector3 initPos)
        {
            position = initPos;
            connections = new List<WeightedEdge>();
        }

        /// <summary>
        /// Alternate default constructor with pathing finding vlaues
        /// </summary>
        /// <param name="initHeuristic">Initial heuristic values</param>
        /// <param name="initEstimatedTotalCost">Initial estimated total cost</param>
        /// <param name="initCostSoFar">Initial Cost So Far</param>

        public Node(float initHeuristic, float initEstimatedTotalCost, float initCostSoFar)
        {
            heuristic = initHeuristic;
            estimatedTotalCost = initEstimatedTotalCost;
            costSoFar = initCostSoFar;

            connections = new List<WeightedEdge>();
        }

        /// <summary>
        /// Adds an edge to the list of edges this node is connected to
        /// </summary>
        /// <param name="newConnection"></param>

        public void addConnection(WeightedEdge newConnection)
        {
            connections.Add(newConnection);
        }

        /// <summary>
        /// Edge List Accessor
        /// </summary>

        public List<WeightedEdge> Connections
        {
            get { return connections; }
        }

        /// <summary>
        /// Position Mutator and Accessor
        /// </summary>

        public Vector3 Position
        {
            get { return position;  }
            set { position = value; }
        }

        /// <summary>
        /// Heuristic value Mutator and Accessor
        /// </summary>

        public float Heuristic
        {
            get { return heuristic; }
            set { heuristic = value; }
        }

        /// <summary>
        /// Cost So Far value Accessor and Mutator
        /// </summary>

        public float CostSoFar
        {
            get { return costSoFar; }
            set { costSoFar = value; }
        }

        /// <summary>
        /// Estimated Total Cost value Accessor and Mutator
        /// </summary>

        public float EstimatedTotalCost
        {
            get { return estimatedTotalCost; }
            set { estimatedTotalCost = value; }
        }

        /// <summary>
        /// Optimal Path node Accessor and Mutator
        /// </summary>

        public Node OptimalPath
        {
            get { return optimalPath; }
            set { optimalPath = value; }
        }

        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        //Data Members


        Vector3 position;
        float heuristic;
        float estimatedTotalCost;
        float costSoFar;
        Node optimalPath; 

        List<WeightedEdge> connections;
        int id;

    }
}
